from django.shortcuts import render
import random
from django.http import HttpResponse
# from untils.tencents import sms
from untils.aliyun import sms

from app01 import My_From


# Create your views here.


def send_sms(request):
    code = random.randrange(1000, 9999)
    print(code)
    res = sms.send_sms("13612401131", "SMS_302796302","{'code':%s}" % (code))
    if res == "OK":
        return HttpResponse('成功')
    else:
        return HttpResponse(res)


def register(request):
    form = My_From.RegisterModelForm()
    return render(request, 'app01/register.html', {'form': form})
